package com.fh.fruit.service.basearea.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fh.dao.DaoSupport;
import com.fh.entity.Page;
import com.fh.fruit.entity.basearea.BaseArea;
import com.fh.fruit.service.basearea.BaseAreaManager;
import com.fh.util.PageData;
/**
 * 区域Service
 * @author Administrator
 * @version 2017.11.30 15:39
 */
@Service("baseAreaService")
public class BaseAreaService implements BaseAreaManager {
	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	@Override
	@SuppressWarnings("unchecked")
	public List<BaseArea> listBaseAreas(Page page) throws Exception {
		return (List<BaseArea>) dao.findForList("BaseAreaMapper.baseArealistPage", page);
	}

	@Override
	public void saveBaseAreas(PageData pd) throws Exception {
		dao.save("BaseAreaMapper.savebaseArea", pd);

	}

	@Override
	public int deleteBaseAreas(PageData pd) throws Exception {
		return (int) dao.delete("BaseAreaMapper.delbaseAreas", pd);
	}

	@Override
	public int updateBaseAreas(PageData pd) throws Exception {
		return (int) dao.update("BaseAreaMapper.updatebaseArea", pd);
	}

	@Override
	public BaseArea findById(PageData pd) throws Exception {
		return (BaseArea) dao.findForObject("BaseAreaMapper.findById", pd);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<PageData> findByNameOrCode(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("BaseAreaMapper.findByNameOrCode", pd);
	}

	@Override
	public int selectTotalBaseArea(PageData pd) throws Exception {
		return (int) dao.findForObject("BaseAreaMapper.selectTotalBaseArea", pd);
	}
	@Override
	@SuppressWarnings("unchecked")
	public List<PageData> synTree(int parseInt) throws Exception {
		return (List<PageData>) dao.findForList("BaseAreaMapper.synTree", parseInt);
	}	
}
